package com.xxd.spring.boot.demo.lihonghai.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxd.spring.boot.demo.lihonghai.entity.Curriculum;
import com.xxd.spring.boot.demo.lihonghai.mapper.CurriculumMapper;
import com.xxd.spring.boot.demo.lihonghai.service.CurriculumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CurriculumServiceImpl implements CurriculumService {
    @Autowired
    private CurriculumMapper curriculumMapper;

    @Override
    public int add(Curriculum curriculum) {
        return curriculumMapper.insert(curriculum);
    }

    @Override
    public int update(Curriculum curriculum) {
        return curriculumMapper.updateById(curriculum);
    }

    @Override
    public int delete(Integer id) {
        return curriculumMapper.deleteById(id);
    }

    @Override
    public IPage<Curriculum> listpage(Page page, Map<String, Object> params) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.setEntity(params);
        return curriculumMapper.selectPage(page,queryWrapper);
    }

    @Override
    public List<Curriculum> list(Map<String, Object> params) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.setEntity(params);
        return curriculumMapper.selectList(queryWrapper);
    }
}
